package com.cn.wanxi.service.impl;

import com.cn.wanxi.dto.HomeDto;
import com.cn.wanxi.dto.NavDto;
import com.cn.wanxi.model.*;
import com.cn.wanxi.service.*;

import java.util.List;

public class HomeServiceImpl implements IHomeService {
    @Override
    public ResultModel getHomeData() {
        ResultModel resultModel = new ResultModel();
        HomeDto homeDto = new HomeDto();

        homeDto.setNewsModelList(getNewsModelList());
        homeDto.setProductModelList(getProductModelList());

        resultModel.setObject(homeDto);//最终传递给前台页面
        return resultModel;
    }


    private List<NewsModel> getNewsModelList() {
        INewsService iNewsService = new NewsServiceImpl();
        return iNewsService.getList();
    }

    private List<ProductModel> getProductModelList() {
        IProductService iProductService = new ProductServiceImpl();
        return iProductService.getHomeList();
    }
}
